import user from '../api/user'


const data = {
  openid: '',
  user: {}
}

const init = (openid) => {
  data.openid = openid;
  refreshUser()
}

const  refreshUser =async () => {
  return new Promise((reslove,reject)=>{
    user.me({openid: data.openid}).then(res => {
      data.user = res.data
      if(res.data.nickName!=''){
        var app = getApp()
        app.globalData.login = true
      }
      reslove(res.data)
    })
  })
}

const fileList = {
  resumeNum: 0,
  worksNum:0,
}

const contestList = []

const zudui = {
  findPersonAll: [], // 队员招募 所有
  findTeamAll: [] // 寻找团队 所有
}

const fileParams = {
  id1: "",
  id2: ""
}

export default {
  data,
  init,
  refreshUser,
  fileList,
  contestList,
  zudui,
  fileParams,
}